import theano
import numpy as np
import theano.tensor as T

# 定义一个float类型的变量x
x = theano.tensor.fscalar('x')
# 定义变量y
y = 1 / (1 + theano.tensor.exp(-x))
# 偏导函数
dx = theano.grad(y, x)
# 定义函数f，输入x，输出
f = theano.function([x], dx)

print(f(3))
